﻿namespace FSLib

type FilterFuga() =
    interface IFilter3D with

        member this.FilterName = "Fuga"
        member this.Description = "2値化"

        member this.Compute mat:byte[,,] =
            let x = - 1 + Array3D.length1 mat 
            let y = - 1 + Array3D.length2 mat 
            let rlt = mat
//            let (b,g,r) = (0uy,0uy,0uy)
            for i in 0..x do
                for j in 0..y do
                    let (b,g,r) = MyArray3D.getCell mat i j
                    if (int b + int g + int r)/3 > 70 then MyArray3D.setCell rlt i j (255uy,255uy,255uy)
                    else MyArray3D.setCell rlt i j (0uy,0uy,0uy)
            rlt
    static member piyo mat x y=
        mat
